﻿using log4net;
using log4net.Config;
using RabbitMqService.Worker;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RabbitMqService.Workers
{
    public static class Log
    {
        private static ILog MailLogger { get; set; }
        private static ILog SMSLogger { get; set; }
        static Log()
        {
            InitLog4Net();
            MailLogger = LogManager.GetLogger("MailLogger");
            SMSLogger = LogManager.GetLogger("SMSLogger");
        }

        public static void WriteMailInfo(string message)
        {


            MailLogger.Info( message);
            DebugWriter.Writer( message);
            
        }

        public static void WriteSMSlInfo(string message)
        {
            SMSLogger.Info(message);
            DebugWriter.Writer(message);

        }













        private static void InitLog4Net()
        {

            var logCfg = new FileInfo(AppDomain.CurrentDomain.BaseDirectory + "log.config");
            XmlConfigurator.ConfigureAndWatch(logCfg);
        }
    }


}
